namespace FormulaRunning.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class first : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.Formula", "UserId", "dbo.UserProfile");
            DropIndex("dbo.Formula", new[] { "UserId" });
            CreateTable(
                "dbo.Comment",
                c => new
                    {
                        CommentID = c.Int(nullable: false, identity: true),
                        UserId = c.Int(nullable: false),
                        FormulaID = c.Int(nullable: false),
                        Cotent = c.String(),
                        SubmitTime = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.CommentID)
                .ForeignKey("dbo.Formula", t => t.FormulaID, cascadeDelete: true)
                .Index(t => t.FormulaID);
            
            AddColumn("dbo.Formula", "SubmitTime", c => c.DateTime(nullable: false));
        }
        
        public override void Down()
        {
            DropIndex("dbo.Comment", new[] { "FormulaID" });
            DropForeignKey("dbo.Comment", "FormulaID", "dbo.Formula");
            DropColumn("dbo.Formula", "SubmitTime");
            DropTable("dbo.Comment");
            CreateIndex("dbo.Formula", "UserId");
            AddForeignKey("dbo.Formula", "UserId", "dbo.UserProfile", "UserId", cascadeDelete: true);
        }
    }
}
